import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Scanner;

/**
 * @author Administrator
 * @version 2021/5/21 0021
 */
public class FileBatchCreateTool {
    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        System.out.print("输入根目录：");
        File file = new File(scanner.nextLine());
        File[] files = file.listFiles();
        if (files == null || files.length == 0) {
            return;
        }
        createFilesRecursively(files);
    }

    private static void createFilesRecursively(File[] files) {
        for (File f : files) {
            System.out.println(f.getPath());
            File[] temp = f.listFiles();
            if (!f.isDirectory()) {
                continue;
            }
            if (temp != null && temp.length != 0) {
                createFilesRecursively(temp);
            }
            try {
                Files.createFile(Paths.get(f.getPath(), "README.md"));
            } catch (IOException e) {
                //
            }
        }
    }
}
